package com.yonyou.cyxdms.sysAuth.service.feign.channelclient;


import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yonyou.cms.channel.client.dto.message.*;
import com.yonyou.cms.channel.client.entity.message.DealerAuthenticationDataDTO;
import com.yonyou.cms.channel.client.vo.message.DealerAttachVO;
import com.yonyou.cyx.framework.bean.dto.framework.RestResultResponse;
import com.yonyou.cyxdms.basedata.client.domains.vo.RegionVO;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;


/**
 * feign
 *
 * @author: renwd
 * @since: 2019/9/19
 * @version:1.0 Copyright: Copyright (c) 2018
 */

@FeignClient(name = "${feign.dms.repair.name:channel-service}")
public interface CmsChannelCommonClient {

    /**
     * 根据ID返回经销商信息
     *
     * @param id
     * @return Map
     * @author 程亮
     * @since 2019/9/19
     */
    @GetMapping("/message/dealerAttach/dealerInfo/{id}")
    RestResultResponse<DealerAttachVO> getDealerInfoById(@PathVariable("id") Long id);

    @PostMapping("/message/dealerAttach/dealerInfo")
    RestResultResponse dealerInfo(@RequestBody DealerInfoDTO dto) ;

    /**
     * 根据ID返回经销商信息
     *
     * @param code
     * @return Map
     * @author 程亮
     * @since 2019/9/19
     */
    @GetMapping("/message/dealerAttach/dealerInfo/bycode/{code}")
    RestResultResponse<DealerAttachVO> getDealerInfoByDealerCode(@PathVariable("code") String code);

    /**
     *
     * 功能说明    : 根据事业部查询经销商列表
     * 创建者         : Administrator
     * 修改日期    : 2019年10月24日
     * @param appId
     * @param deptId 事业部ID
     * @return
     */
    @GetMapping("/message/dealerAttach/list")
    RestResultResponse<List<DealerAttachVO>> getDealerList(@RequestParam(value = "appId") String appId,@RequestParam(value = "deptId") Long deptId);

    /**
     *
     * 功能说明    : 根据办事处查询经销商列表
     * 创建者         : Administrator
     * 修改日期    : 2019年10月24日
     * @param appId
     * @param officeId 办事处ID
     * @return
     */
    @GetMapping("/message/dealerAttach/office/list")
    RestResultResponse<List<DealerAttachVO>> getOfficeDealerList(@RequestParam(value = "appId") String appId,@RequestParam(value = "officeId") Long officeId);


    /**
     *
     * 功能说明    : 服务间调用分页查询经销商
     * 创建者         : Administrator
     * 修改日期    : 2019年10月29日
     * @param queryCondition
     * @param currentPage 当前页
     * @param pageSize 页码数量
     * @return
     */
    @GetMapping("/message/dealerAttach")
    RestResultResponse<Page<Map<String, Object>>> getList(@RequestParam Map<String, Object> queryCondition, @RequestParam
            ("currentPage") int currentPage, @RequestParam("pageSize") int pageSize);

    /**
     *
     * 功能说明    : 根据用户ID判断是否是区域经理，是区域经理返回其管辖经销商
     * 创建者         : Administrator
     * 修改日期    : 2019年12月4日
     * @param userId 用户ID
     * @return Map<String,Object> {"isManager:":true/false,"dealerList":[]}
     */
    @GetMapping("/manager/regionalManager/check")
    RestResultResponse<Map<String,Object>> checkRegionManager(@RequestParam(value = "appId") String appId,@RequestParam(value = "userId") String userId);

    /**
	 * 渠道-经销商区域经理维护（新增,修改）
	 * @param rolePMaps 业务数据
	 * 		userId	用户id
	 * 		deptId	事业部id
	 * 		officeId	办事处id
	 * @return 添加的数据
	 */
	@PostMapping("/manager/regionalManager/addManager")
	RestResultResponse<Map<String,Object>> supplementRegionalManager(@RequestBody Map<String, Object> managerMaps);

	/**
	 * 渠道-经销商区域经理维护（删除）
	 * @param rolePMaps 业务数据
	 * 		userId	用户id
	 * @return 删除的数据
	 */
	@PostMapping("/manager/regionalManager/deleteManager")
	RestResultResponse<Map<String,Object>> deleteRegionalManager(@RequestBody Map<String, Object> managerMaps);


	/**
     *
     * 根据appId查询所有有效的经销商dealerCompanyId
     * 创建者         : Administrator
     * 修改日期    : 2019年10月24日
     * @param appId
     * @param officeId 办事处ID
     * @return
     */
    @GetMapping("/message/dealerAttach/getEffectDealerCompanyIdByAppId")
    RestResultResponse<List<String>> getEffectDealerCompanyIdByAppId(@RequestParam(value = "appId") String appId);



   /**
   * @Description:
   * @Param:
   * @return:
   * @Author: wangsht
   * @Date: 2021/4/6
   */
    @PostMapping("/manager/regionalManager/getRegionalManagerJurisdiction")
    RestResultResponse<Map<String,Object>> getRegionalManagerJurisdiction(@RequestBody DealerAuthenticationDataDTO dto);





    /**
     * 查询经销商信息
     * @param dealerAttachQueryDTO
     * @return
     */
    @PostMapping("/message/dealerAttach/dealerInfo/byAllInfoForAgent")
    RestResultResponse<List<DealerAttachVO>> getDealerInfoByAllInfoForAgent(@RequestBody DealerAttachQueryForAgentDTO dealerAttachQueryDTO);

    /**
     * 查询经销商明细信息
     * @param dealerCode
     * @return
     */
    @GetMapping("/message/dealerAttach/dealerInfo/byAllInfoDetail")
    RestResultResponse<DealerAttachVO> getDealerbyAllInfoDetail(@RequestParam(value = "dealerCode") String dealerCode);


    /**
     * 获取经销商入网信息
     */
    @GetMapping("/message/dealerAttach/getNetInMessage")
    RestResultResponse<Map<String,List<Map<String, Object>>>> getNetInMessage(@RequestParam("dealerCode") String dealerCode,@RequestParam("appId") String appId);

    /**
     * 经销商信息查询-索赔
     *
     * @author lyz
     * @date 2021/01/22
     */
    @ApiOperation("经销商信息查询-索赔")
    @PostMapping("/message/dealerAttach/dealerInfo/allDealerInfoDetailSP")
    RestResultResponse<Page<DealerAttachSPResDTO>> allInfoDetailSp(@RequestBody DealerAttachSPReqDTO dto);

    /**
     * 查询CMS/SAP经销商代码
     *
     * @param dealerCodeReqDTO
     * @return com.yonyou.cyx.framework.bean.dto.framework.RestResultResponse<com.yonyou.cms.channel.client.dto.message.DealerCodeResDTO>
     * @author caozx
     * @since 2021/03/09
     */
    @ApiOperation("查询CMS/SAP经销商代码")
    @PostMapping("/message/dealerAttach/searchDealerCode")
    RestResultResponse<DealerCodeResDTO> searchDealerCode(@RequestBody DealerCodeReqDTO dealerCodeReqDTO);

    /**
     * 经销商区域经理查询
     *
     * @param queryCondition queryCondition
     * @return  list
     * @author wzf
     */
    @ApiOperation("经销商区域经理查询")
    @GetMapping("/manager/regionalManager/selectForFeign")
    RestResultResponse<List<Map<String, Object>>> selectForFeign(@RequestParam Map<String, Object> queryCondition);

    /**
     * @Description: 通过经销商编号OwnerCode获取油电
     * @Author: wangsht
     * @Date: 2021/7/1
     * @param ownerCode 经销商编号
     * @return: rlt.data  3 油车\电车,2 油车,1 电车
     **/
    @ApiOperation("通过经销商编号OwnerCode获取油电")
    @GetMapping("/message/dealerAttach/getFinanceCompanyIdByOwnerCode")
    String getFinanceCompanyIdByOwnerCode(@RequestParam(value = "ownerCode") String ownerCode);


    /**
     * @Description: 获取Sapoil和SapCode编码
     * @Author: wangsht
     * @Date: 2021/7/1
     * @param appId appid ，powerType 油电
     *
     * @return:
     **/
    @ApiOperation("获取Sapoil和SapCode编码")
    @GetMapping("/message/dealerAttach/getSapoilOrSapCode")
    RestResultResponse<List<String>> getSapoilOrSapCode(@RequestParam(value = "appId") String appId,@RequestParam(value = "powerType") String powerType);

    @GetMapping("/message/dealerAttach/getCodeByAppId")
    RestResultResponse<List<String>> getCodeByAppId(@RequestParam("appId") String appId);

    @GetMapping("/message/dealerAttach/dealerInfo/byAllTranslate")
    RestResultResponse<List<DealerAttachVO>> byAllTranslate(@RequestParam("appId") String appId);

    /**
     * @Description:
     * @Author: wangsht
     * @Date: 2022/3/15
     * @param DealerAttachModelDTO
     * @return: null
     **/
    @ResponseBody
    @PostMapping(value="/apply/dealerApply/dealer/getDealerAttachModel")
    @ResponseStatus(HttpStatus.CREATED)
    @ApiOperation(value = "通过车型获取经销商", notes = "通过车型获取经销商", httpMethod = "POST",
            produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParams({@ApiImplicitParam(value = "用户id", name = "userId", required = true, dataType = "string", paramType = "header")})
    public RestResultResponse<List<Long>> getDealerAttachModel(@RequestParam("dealerCode") String dealerCode);
}
